package com.ruoyi.web.controller.mes;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.kt.mes.domain.ProlSiteActParam;
import com.kt.mes.service.IProlSiteActParamService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 动作参数Controller
 *
 * @author lzc
 * @date 2021-01-15
 */
@RestController
@RequestMapping("/mes/site_param")
public class ProlSiteActParamController extends BaseController
{
    @Autowired
    private IProlSiteActParamService prolSiteActParamService;

    /**
     * 查询动作参数列表
     */
 //   @PreAuthorize("@ss.hasPermi('mes:site_param:list')")
    @GetMapping("/list")
    public TableDataInfo list(ProlSiteActParam prolSiteActParam)
    {
        startPage();
        List<ProlSiteActParam> list = prolSiteActParamService.selectProlSiteActParamList(prolSiteActParam);
        return getDataTable(list);
    }

    /**
     * 导出动作参数列表
     */
   // @PreAuthorize("@ss.hasPermi('mes:site_param:export')")
    @Log(title = "动作参数", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(ProlSiteActParam prolSiteActParam)
    {
        List<ProlSiteActParam> list = prolSiteActParamService.selectProlSiteActParamList(prolSiteActParam);
        ExcelUtil<ProlSiteActParam> util = new ExcelUtil<ProlSiteActParam>(ProlSiteActParam.class);
        return util.exportExcel(list, "site_param");
    }

    /**
     * 获取动作参数详细信息
     */
  //  @PreAuthorize("@ss.hasPermi('mes:site_param:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(prolSiteActParamService.selectProlSiteActParamById(id));
    }

    /**
     * 新增动作参数
     */
   // @PreAuthorize("@ss.hasPermi('mes:site_param:add')")
    @Log(title = "动作参数", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ProlSiteActParam prolSiteActParam)
    {
        return toAjax(prolSiteActParamService.insertProlSiteActParam(prolSiteActParam));
    }

    /**
     * 修改动作参数
     */
  //  @PreAuthorize("@ss.hasPermi('mes:site_param:edit')")
    @Log(title = "动作参数", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ProlSiteActParam prolSiteActParam)
    {
        return toAjax(prolSiteActParamService.updateProlSiteActParam(prolSiteActParam));
    }

    /**
     * 删除动作参数
     */
   // @PreAuthorize("@ss.hasPermi('mes:site_param:remove')")
    @Log(title = "动作参数", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(prolSiteActParamService.deleteProlSiteActParamByIds(ids));
    }
}
